const dao = require('./Dao');
const models = require('../models/index');

//1.创建所有模型表
module.exports.creatAll = async () => {
  for (let key in models) {
    const res = await dao.createTable(models[key]);
    if (res) {
      console.log(key + '创建成功');
    } else {
      console.log(key + '创建失败');
    }
  }
};

//2.删除所有模型表
module.exports.deleteAll = async () => {
  for (let key in models) {
    await dao.dropTable(models[key]);
    console.log(key + '删除成功');
  }
};
